﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace 人事工资管理系统
{
    public partial class frmChangeUser : Form
    {
        public frmChangeUser()
        {
            InitializeComponent();
        }
        PMSClass.DBOperate operate = new PMSClass.DBOperate();
        private void frmChangeUser_Load(object sender, EventArgs e)
        {
            try
            {
                operate.BindDropdownlist("tb_User", comboBox1, 1);
                comboBox1.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void toolStripLabel1_Click(object sender, EventArgs e)
        {
            string name = comboBox1.SelectedItem.ToString();
            string str = "update tb_User set UserName='" + textBox2.Text.Trim() + "'where UserName='"+name+"'";
            operate.OperateData(str);
            MessageBox.Show("修改成功", "警告", MessageBoxButtons.OK, MessageBoxIcon.Information);
            
        }

        private void toolStripLabel2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void textBox2_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 13)
            {
                toolStripLabel1_Click(sender, e);
            }
        }

    }
}
